import AdminUserManagerView from '@/views/AdminUserManagerView.vue'
import HomeView from '@/views/HomeView.vue'
import Layout from '@/views/Layout.vue'
import LoginView from '@/views/LoginView.vue'
import LunBoManagerView from '@/views/LunBoManagerView.vue'

import OrderManagerView from '@/views/OrderManagerView.vue'
import ProductManagerView from '@/views/ProductManagerView.vue'
import RiBaoManagerView from '@/views/RiBaoManagerView.vue'
import ToDosManagerView from '@/views/ToDosManagerView.vue'
import TongZhiManagerView from '@/views/TongZhiManagerView.vue'
import UserManagerView from '@/views/UserManagerView.vue'
import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Layout',
      component: Layout,
      redirect: '/home', //重定向
      children: [
        // 配置layout页面中的router-view的切换（二级路由）
        {
          path: '/home',
          name: 'home',
          component: HomeView,
        },
        {
          path: '/admin-user',
          name: 'admin-user',
          component: AdminUserManagerView,
        },
        {
          path: '/pro-man',
          name: 'pro-man',
          component: ProductManagerView,
        },
        {
          path: '/order-man',
          name: 'order-man',
          component: OrderManagerView,
        },
        {
          path: '/lunBo-man',
          name: 'lunBo-man',
          component: LunBoManagerView,
        },
        {
          path: '/user-man',
          name: 'user-man',
          component: UserManagerView,
        },
        {
          path: '/riBao-man',
          name: 'riBao-man',
          component: RiBaoManagerView,
        },
        {
          path: '/tongZhi-man',
          name: 'tongZhi-man',
          component: TongZhiManagerView,
        },
        {
          path: '/toDos-man',
          name: 'toDos-man',
          component: ToDosManagerView,
        },
      ],
    },
    {
      path: '/Login',
      name: 'Login',
      component: LoginView,
    },
  ],
})

export default router
